package com.emergency.examine.dao;


import com.emergency.examine.domain.Option;
import com.emergency.examine.domain.QuestionScore;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


public interface QuestionScoreDao extends JpaRepository<QuestionScore, Long>, JpaSpecificationExecutor<QuestionScore> {
    @Modifying
    @Transactional
    @Query(value = "delete FROM ex_question_score WHERE exam_id = ? ", nativeQuery = true)
    void deleteByExamId(Long examId);

    @Query("select qs from QuestionScore qs where exam.id = :questionId")
    List<QuestionScore> findAllByExam(Long examId);
}
